<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	
	
	<h:form id="lineFaultForm">
		<div id="headDiv" class="box box-solid with-border">
			<div class="box-header">
				<p:outputLabel for="popup1" value="时间间隔：" style="float:left;margin-top:5px" />
				<p:calendar id="popup1" navigator="true" maxdate="Date()"
					value="#{deviceFaultCountController.startTime}"
					pattern="yyyy-MM-dd" style="float:left" size="14">
				</p:calendar>
				<p:outputLabel for="popup2" value="至"
					style="margin-right:5px;margin-left:5px;float:left;margin-top:5px" />
				<p:calendar id="popup2" navigator="true"
					value="#{deviceFaultCountController.endTime}"
					pattern="yyyy-MM-dd" maxdate="Date()" style="float:left" size="14">
				</p:calendar>
				<p:outputLabel value="电压等级："
					style="float:left;margin-top:5px;margin-left:10px" />
				<p:selectOneMenu id="voltage"
					value="#{deviceFaultCountController.voltage}"
					style="width:125px;margin-left:5px;float:left">
					<f:selectItem itemLabel="500kV" itemValue="500" />
					<f:selectItem itemLabel="220kV" itemValue="220" />
					<f:selectItem itemLabel="110kV" itemValue="110" />
					<f:selectItem itemLabel="全部" itemValue="" />
				</p:selectOneMenu>
				<p:commandButton icon="ui-icon-search" value="查询" update="lineFaultTable"
					actionListener="#{deviceFaultCountController.queryAction}" 
					oncomplete="initFaultCountYear()"
					style="margin-left:10px;">
				</p:commandButton>
				<!-- <p:commandButton value="详细"
					actionListener="#{deviceFaultCountController.showDetail()}"
					oncomplete="initDataTable();"
					update="lineFaultTable" icon="ui-icon-calculator" /> -->
				<p:commandButton value="导出excel" ajax="false"
					onclick="PrimeFaces.monitorDownload(start, stop);"
					actionListener="#{deviceFaultCountController.fileDownLoad}"
					icon="ui-icon-arrowthick-1-s"
					rendered="#{s:hasPermission(session,'bhyx_gzytj_dcExcel')}">
					<p:fileDownload value="#{deviceFaultCountController.file}" />
				</p:commandButton>
				<p:commandButton id="reloadBtn" value="刷新"
					actionListener="#{deviceFaultCountController.reloadSingleFaultSource}"
					oncomplete="initDataTable();"
					update="lineFaultTable reloadBtn" icon="ui-icon-refresh"
					disabled="#{deviceFaultCountController.selected == null}" />
				<p:commandButton value="统计"
					update="countDetail:countInfoDialog" icon="fa fa-bar-chart"
					actionListener="#{deviceFaultCountController.getLineFaultUploadInfos}" oncomplete="completeOver()"/>
			</div>
		</div>
		<p:dialog modal="true" widgetVar="statusDialog" width="70px"
			draggable="false" closable="false" resizable="false">
			<p:graphicImage value="#{request.contextPath}/resources/plugins/layer/skin/default/loading-1.gif" />
		</p:dialog>
		
		<p:dataTable id="lineFaultTable" var="info"     scrollWidth="100%"
			value="#{deviceFaultCountController.lineFaultUploadInfoDtos}"
			emptyMessage="无记录" style="text-align:center" rows="10"
			paginator="true" paginatorPosition="bottom"
			paginatorTemplate="{Customer} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
			rowsPerPageTemplate="10,20,50" rowKey="#{info.id}" scrollable="true">
			<f:facet name="{Customer}">
				<p:outputLabel value="总计：#{deviceFaultCountController.lineFaultUploadInfoDtos.size()}条纪录"
					style="margin-right:20px" />
			</f:facet>
			<p:ajax event="rowSelectRadio" update=":lineFaultForm:reloadBtn"
				listener="#{deviceFaultCountController.onRowSelect}" />
			<p:column selectionMode="single" style="width:100px;heigth:50px;" />
			<p:columnGroup type="header">
				<p:row>
					<p:column  rowspan="2" headerText="" style="width:35px;"/>
					<p:column  rowspan="2" headerText="故障时间"  style="width:150px;heigth:50px;"/>
					<p:column  rowspan="2" headerText="故障情况"  style="width:150px;heigth:50px;"/>
					<p:column  rowspan="2" headerText="厂站"   style="width:120px;heigth:50px;"/>
					<p:column  rowspan="2" headerText="集中录波"  style="width:50px;heigth:50px;"/>
					<p:column  colspan="2" headerText="主一保护"  style="width:120px;heigth:50px;"/>
					<p:column  colspan="2" headerText="主二保护"   style="width:120px;heigth:50px;" />
					<p:column  colspan="2" headerText="主三保护"  style="width:120px;heigth:50px;"/>
					<p:column  colspan="3" headerText="断路器保护一"  style="width:700px;heigth:50px;"/>
					<p:column  colspan="3" headerText="断路器保护二"   style="width:700px;heigth:50px;" />
				<!-- 	<p:column  colspan="2" headerText="辅A保护" rendered="#{deviceFaultCountController.showDetail}" style="width:100px;heigth:50px;"/>
					<p:column  colspan="2" headerText="辅B保护" rendered="#{deviceFaultCountController.showDetail}" style="width:100px;heigth:50px;"/>
					<p:column  colspan="2" headerText="短引线保护一" rendered="#{deviceFaultCountController.showDetail}" style="width:100px;heigth:50px;"/>
					<p:column  colspan="2" headerText="短引线保护二" rendered="#{deviceFaultCountController.showDetail}" style="width:100px;heigth:50px;"/> -->
				    <p:column  rowspan="2" headerText="综合上报完好率"  style="width:60px;heigth:50px;" />
					<p:column  rowspan="2" headerText="保护事件完好率"  style="width:60px;heigth:50px;" />
					<p:column  rowspan="2" headerText="保护录波完好率"  style="width:60px;heigth:50px;"/>
					<p:column  rowspan="2" headerText="集中录波完好率"   style="width:60px;heigth:50px;"/>
				</p:row>
				<p:row>
					<p:column headerText="报文" style="width:50px;" />
					<p:column headerText="录波" style="width:50px;"/>
					<p:column headerText="报文" style="width:50px;"/>
					<p:column headerText="录波" style="width:50px;"/>
					<p:column headerText="报文" style="width:50px;"/>
					<p:column headerText="录波" style="width:50px;"/>
	
					<p:column headerText="名称" style="width:50px;" />
					<p:column headerText="报文" style="width:50px;"/>
					<p:column headerText="录波" style="width:50px;"/>
					<p:column headerText="名称"  style="width:50px;" />
					<p:column id='col1' headerText="报文"  style="width:50px;"/>
					<p:column headerText="录波"  style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="报文" style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="录波" style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="报文" style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="录波" style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="报文" style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="录波" style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="报文" style="width:50px;"/>
					<p:column rendered="#{deviceFaultCountController.showDetail}" headerText="录波" style="width:50px;"/>
				</p:row>
			</p:columnGroup>
	
			<p:column style="height:80px;"  >
				<p:outputLabel>#{deviceFaultCountController.formatterDate(info.faultTime)}</p:outputLabel>
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel">#{info.faultDesc}</p:outputLabel>
			</p:column>
			<p:column >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						value="#{s.stationName}" />
				</ui:repeat>
			</p:column>
			<p:column  ><!--集中录波  -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.waveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getCentralizedStr(s.waveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  > <!--主一保护报文 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.main1DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.main1DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  ><!--主一保护录波 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.main1WaveInfo!=-1 ? 'autoUpload':'failedUpload'}"
						value="#{deviceFaultCountController.getStateStr(s.main1WaveInfo)}" />
				</ui:repeat>
			</p:column>
			<p:column > <!--主二保护报文 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.main2DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.main2DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  ><!--主二保护录波 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.main2WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.main2WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  ><!--主三保护报文 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.main3DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.main3DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  ><!--主三保护录波 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.main3WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.main3WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  ><!--断路器保护一名称 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel title="#{s.breakerProtect1Name}"
						style="white-space:pre;overflow:hidden;text-overflow:ellipsis">#{s.breakerProtect1Name}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  ><!--断路器保护一报文 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;"
						styleClass="#{s.breakerProtect1DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.breakerProtect1DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column ><!--断路器保护一录波 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;"
						styleClass="#{s.breakerProtect1WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.breakerProtect1WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column><!--断路器保护二名称 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel title="#{s.breakerProtect2Name}"
						style="white-space:pre;overflow:hidden;text-overflow:ellipsis">#{s.breakerProtect2Name}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column><!--断路器保护二报文 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.breakerProtect2DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.breakerProtect2DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column ><!--断路器保护二录波 -->
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.breakerProtect2WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.breakerProtect2WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column rendered="#{deviceFaultCountController.showDetail}">
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.assistProtect1DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.assistProtect1DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column rendered="#{deviceFaultCountController.showDetail}" >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.assistProtect1WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.assistProtect1WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column rendered="#{deviceFaultCountController.showDetail}" >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.assistProtect2DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.assistProtect2DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column rendered="#{deviceFaultCountController.showDetail}"  >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.assistProtect2WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.assistProtect2WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
	
			<p:column rendered="#{deviceFaultCountController.showDetail}" >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.shortLeadProtect1DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.shortLeadProtect1DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column rendered="#{deviceFaultCountController.showDetail}" >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.shortLeadProtect1WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.shortLeadProtect1WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column rendered="#{deviceFaultCountController.showDetail}" >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.shortLeadProtect2DatagramInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.shortLeadProtect2DatagramInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column rendered="#{deviceFaultCountController.showDetail}"  >
				<ui:repeat var="s" value="#{info.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.shortLeadProtect2WaveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getStateStr(s.shortLeadProtect2WaveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel0"  value="#{info.totalIntactRate}%"></p:outputLabel>
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel2"   value="#{info.protectEventIntactRate}%"></p:outputLabel>
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel3"  value="#{info.protectWaveIntactRate}%"></p:outputLabel>
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel4" value="#{info.centralWave}%" ></p:outputLabel>
			</p:column>
		</p:dataTable>
	</h:form>
	<h:form id="countDetail">
		<p:dialog modal="true" header="本次查询统计" width="1500" height="700" id="countInfoDialog" widgetVar="countInfoDialog">
			<p:outputLabel style="color:red;">
				注：只统计交流线路信息<br />
			</p:outputLabel>
			<div class="nav-tabs-custom">
				<ul id="tabs" class="nav nav-tabs pull-left ">
					<li class="active"><a href="#countChart" data-toggle="tab">图形展示</a></li>
					<li id="chartTab"><a href="#countTable" data-toggle="tab">表格展示</a></li>
				</ul>
				<div class="tab-content no-padding">
					<div class="chart tab-pane active" id="countChart" style="position: relative">
						<p:outputLabel value="统计方式：" style="float:left;margin-top:15px;margin-left:10px" />
				        <h:selectOneMenu id="selectMenu" style="margin-top:10px;width:150px;height:30px" onchange="initLineFaultChartDate();">
							<f:selectItem itemLabel="按调度单位" itemValue="0" />
							<f:selectItem itemLabel="按运维单位" itemValue="1" />
						</h:selectOneMenu>
						<p:outputLabel value="数据源：" style="margin-top:15px;margin-left:10px" />
				        <h:selectOneMenu id="selectDataSource" style="margin-top:10px;width:150px;height:30px" onchange="initLineFaultChartDate();">
							<f:selectItem itemLabel="集中录波" itemValue="0" />
							<f:selectItem itemLabel="保护录波" itemValue="1" />
							<f:selectItem itemLabel="保护事件" itemValue="2" />
						</h:selectOneMenu>
						<div id="countbar" style="height: 400px; margin: 0 auto;text-align:center;color:grey;font-size:16px;font-weight:bold" />
					</div>
					<div class="chart tab-pane" id="countTable" style="position: relative">
						<p:panelGrid id="pg" style="width:100%">
							<p:row>
								<p:column rowspan="2">
									<p:outputLabel value="" />
								</p:column>
								<p:column rowspan="2">
									<p:outputLabel value="应评价次数" />
								</p:column>
								<p:column colspan="3">
									<p:outputLabel value="实际上送次数" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<p:outputLabel value="自动电子化上送次数" />
								</p:column>
								<p:column>
									<p:outputLabel value="人工电子化上送次数" />
								</p:column>
								<p:column>
									<p:outputLabel value="综合电子化上送次数" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<p:outputLabel value="集中录波" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.centerWaveShould}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.centerWaveActualUpload}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.centerWaveManualUpload}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.centerWaveActualUpload+deviceFaultCountController.countDto.centerWaveManualUpload}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<p:outputLabel value="保护录波" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectWaveShould}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectWaveActualUpload}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectWaveManualUpload}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectWaveActualUpload+deviceFaultCountController.countDto.protectWaveManualUpload}" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<p:outputLabel value="保护事件" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectEventShould}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectEventActualUpload}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectEventManualUpload}" />
								</p:column>
								<p:column>
									<h:outputText value="#{deviceFaultCountController.countDto.protectEventActualUpload+deviceFaultCountController.countDto.protectEventManualUpload}" />
								</p:column>
							</p:row>
						</p:panelGrid>
					</div>
				</div>
			</div>
		</p:dialog>
	</h:form>
</ui:composition>
